<?php
namespace app\index\controller;

use app\admin\model\UserModel;
use think\Controller;
use think\Db;
use app\index\model\ConfigModel;
use app\index\model\CardModel;
use app\index\model\LoanModel;
use app\index\model\ApplyModel;
use app\index\model\UsersModel;
use app\index\model\CashModel;
use app\index\model\UserMoney;
use think\Request;
class index extends Base{
   public function index(){
       $model=new ConfigModel();
       $usersModel=new UsersModel();
       $this->assign([
           'user'=>$usersModel->findUserById(session('user_id')),
           'credit_url'=>$model->getCreditUrl(),
           'top_banner'=>$model->getBanner(0),
           'btm_banner1'=>$model->getBanner(1),
           'btm_banner2'=>$model->getBanner(2)
       ]);
       return $this->fetch();
   }
   function loan(){
       $param=input('param.');
       if(request()->isPost()) {
           $model=new LoanModel();
           return json(msg(1, $model->getLists($param), ''));
       }
       return $this->fetch();
   }
    function card(){
        $param=input('param.');
        if(request()->isPost()) {
            $model=new CardModel();
            return json(msg(1, $model->getLists($param), ''));
        }
        return $this->fetch();
    }
    function cardProgress(){
        $param=input('param.');
        if(request()->isPost()) {
            $model=new CardModel();
            return json(msg(1, $model->getCardProgress($param), ''));
        }
        return $this->fetch();
    }
    function loanDetail(){
        $param=input('param.');
        $model=new LoanModel();
        $this->assign([
            'data'=>$model->getOne($param['pid'])
        ]);
        return $this->fetch();
    }


}
